package com.study.zouchao.superproject.util;

import android.support.v4.widget.NestedScrollView;
import android.util.Log;

/**
 * 注：当NestedScrollView嵌套RecyclerView时
 *  会导致RecyclerView的onScroll滚动事件失效
 *      解决办法：直接判断NestedScrollView的滚动事件
 * Created by Administrator on 2017/6/21.
 */

public class OnScrollChangeListener implements NestedScrollView.OnScrollChangeListener {
    @Override
    public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
        if (scrollY > oldScrollY) {
            Log.i("滚动", "Scroll DOWN");
        }
        if (scrollY < oldScrollY) {
            Log.i("滚动", "Scroll UP");
        }

        if (scrollY == 0) {
            Log.i("滚动", "TOP SCROLL");
        }

        if (scrollY == (v.getChildAt(0).getMeasuredHeight() - v.getMeasuredHeight())) {
            Log.i("管道工", "BOTTOM SCROLL");
        }
    }

    /**
     * 对外接口
     */
    public interface IOnSlideToBottomListener {
        void onSeeMore();
    }
}
